<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page import="database.*"%>
<%@page import="java.util.List"%>

<%@page import="java.text.SimpleDateFormat"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Insert title here</title>
</head>
<body>
<jsp:include page="./nav.jsp"></jsp:include>
<% 
request.setCharacterEncoding("utf-8");
int articleID = 0;
List<Comment> list = DatabaseManager.commentQueryByArticleID(articleID);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
%>
<div style="width:700px;text-align:left">
	<form action="NewCommentServlet" method="post">
		<input type="hidden" name="articleID" value="<%=articleID %>" />
		<textarea rows="5" cols="84" name="comment" id="comment"></textarea><br />
		<div style="float:right"><input type="submit" value="发表评论" /></div>
	</form>
</div>
<%
for(Comment comment : list) {
%>
	<div style="width:700px; background-color:#dcdcdc; text-align:left">
		<p><%=comment.getCommenter() + "&nbsp;发表于" + formatter.format(comment.getPublishTime()) %></p>
	</div>
	<div style="width:700px; background-color:#f0ffff; text-align:left">
		<p><%=comment.getContent() %></p>
	</div>
<% } %>
</body>
</html>